package com.difsonapps.contacttranslator.service.impl;

import java.util.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.difsonapps.contacttranslator.dao.ContactDAO;
import com.difsonapps.contacttranslator.dto.ContactDTO;
import com.difsonapps.contacttranslator.service.itf.ContactService;

@Repository
@Transactional
public class ContactServiceImpl implements ContactService {
	@Autowired
	protected ContactDAO contactDAO;

	@Transactional
	public void insert(ContactDTO contactDTO) {
		contactDAO.insert(contactDTO);
	}

	@Transactional
	public void update(ContactDTO contactDTO) {
		contactDAO.update(contactDTO);
	}

	@Transactional
	public ContactDTO get(int id) {
		return contactDAO.get(id);
	}

	@SuppressWarnings("unchecked")
	@Transactional
	public List<ContactDTO> getAll() {
		return contactDAO.getAll();
	}

	@Transactional
	public void delete(ContactDTO contactDTO) {
		contactDAO.delete(contactDTO);
	}

	public ContactDTO getByContactIdDeviceId(String contactid,String deviceid) {
		return contactDAO.getByContactIdDeviceId(contactid, deviceid);
	}

	public List<ContactDTO> getByUserEmail(String email) {
		// TODO Auto-generated method stub
		return contactDAO.getByUserEmail(email);
	}

	public List<ContactDTO> getByNumberAndEmail(String contactid, String deviceid, String email,
			String[] listOffNumber, String[] listOffEmails) {
		
		return contactDAO.getByNumberAndEmail( contactid, deviceid, email, listOffNumber, listOffEmails);
	}
}
